package flc.ast.adapter;


import android.graphics.Color;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.CycleBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class CycleAdapter extends StkProviderMultiAdapter<CycleBean> {


    public CycleAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new CycleProvider());
    }

    private class CycleProvider extends BaseItemProvider<CycleBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_cycle;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, CycleBean bean) {
            baseViewHolder.setText(R.id.tvCycleItemName, bean.getName());
            if (bean.isSelected()) {
                baseViewHolder.setBackgroundColor(R.id.llCycleItem, Color.parseColor("#5476FC"));
                baseViewHolder.setTextColor(R.id.tvCycleItemName, Color.parseColor("#FFFFFF"));
            } else {
                baseViewHolder.setBackgroundColor(R.id.llCycleItem, Color.parseColor("#F0F4FF"));
                baseViewHolder.setTextColor(R.id.tvCycleItemName, Color.parseColor("#000000"));

            }
        }
    }

}
